﻿using NHibernate.Mapping.ByCode;
using NHibernate.Mapping.ByCode.Conformist;
using SellAndBuy.Application.Query.DTOs;

namespace SellAndBuy.Infrastructure.Data.Query.Mappings
{
    public class CustomerDTOMap : ClassMapping<CustomerDTO>
    {
        public CustomerDTOMap()
        {
            Lazy(false);
            Table("Customer");
            Id(x => x.ID);
            Property(x => x.FirstName, map => map.NotNullable(true));
            Property(x => x.LastName, map => map.NotNullable(true));
            Property(x => x.Email, map =>
                                       {
                                           map.Unique(true);
                                           map.Length(50);
                                           map.NotNullable(true);
                                       });
        }
    }
}